<html>
<head>
    <meta charset="utf-8">
    <title>打印金字塔</title>
    <style>
        .box{background-color: #000;margin: 3px;padding:2px; font-size: 24px; font-weight: bold; color:#FFFF00;}
        .out{border:solid; 3px #000; float: left; overflow: hidden;}
    </style>
</head>
<body>
<div class="out">
    <div class="box">
        <?php
        /**
         * Created by PhpStorm.
         * User: Administrator
         * Date: 2016/9/28 0028
         * Time: 下午 7:13
         */
        $line=1;
        while($line<=5){
            $empty_pos=$star_pot=1;
            $empty=5-$line;
            $star=2*$line-1;
            while($empty_pos<= $empty) {
                echo '&nbsp;';
                ++$empty_pos;
            }
            while ($star_pot<=$star){
                echo '*';
                ++$star_pot;
            }
            echo '<br>';
            ++$line;
        }
        $a=2;
        $b=++$a;
        ?>
    </div>
</div>
</body>
</html>
